1 /* 2 3 Boost Software License - Version 1.0 - August 17th, 2003 4 5 Permission is hereby granted, free of charge, to any person or organization 6 obtaining a copy of the software and accompanying documentation covered by 7 this license (the "Software") to use, reproduce, display, distribute, 8 execute, and transmit the Software, and to prepare derivative works of the 9 Software, and to permit third-parties to whom the Software is furnished to 10 do so, all subject to the following: 11 12 The copyright notices in the Software and this entire statement, including 13 the above license grant, this restriction and the following disclaimer, 14 must be included in all copies of the Software, in whole or in part, and 15 all derivative works of the Software, unless such copies or derivative 16 works are solely in the form of machine-executable object code generated by 17 a source language processor. 18 19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 DEALINGS IN THE SOFTWARE. 26 27 */ 28 29 module derelict.glib.goption; 30 31 import derelict.glib.gtypes; 32 import derelict.glib.glibconfig; 33 import derelict.glib.gerror; 34 import derelict.glib.gquark; 35 36 extern (C): 37 38 alias _GOptionContext GOptionContext; 39 alias _GOptionGroup GOptionGroup; 40 alias _GOptionEntry GOptionEntry; 41 alias _Anonymous_0 GOptionFlags; 42 alias _Anonymous_1 GOptionArg; 43 alias int function (const(char)*, const(char)*, void*, _GError**) GOptionArgFunc; 44 alias int function (_GOptionContext*, _GOptionGroup*, void*, _GError**) GOptionParseFunc; 45 alias void function (_GOptionContext*, _GOptionGroup*, void*, _GError**) GOptionErrorFunc; 46 alias _Anonymous_2 GOptionError; 47 48 enum _Anonymous_0 49 { 50 G_OPTION_FLAG_HIDDEN = 1, 51 G_OPTION_FLAG_IN_MAIN = 2, 52 G_OPTION_FLAG_REVERSE = 4, 53 G_OPTION_FLAG_NO_ARG = 8, 54 G_OPTION_FLAG_FILENAME = 16, 55 G_OPTION_FLAG_OPTIONAL_ARG = 32, 56 G_OPTION_FLAG_NOALIAS = 64 57 } 58 59 enum _Anonymous_1 60 { 61 G_OPTION_ARG_NONE = 0, 62 G_OPTION_ARG_STRING = 1, 63 G_OPTION_ARG_INT = 2, 64 G_OPTION_ARG_CALLBACK = 3, 65 G_OPTION_ARG_FILENAME = 4, 66 G_OPTION_ARG_STRING_ARRAY = 5, 67 G_OPTION_ARG_FILENAME_ARRAY = 6, 68 G_OPTION_ARG_DOUBLE = 7, 69 G_OPTION_ARG_INT64 = 8 70 } 71 72 enum _Anonymous_2 73 { 74 G_OPTION_ERROR_UNKNOWN_OPTION = 0, 75 G_OPTION_ERROR_BAD_VALUE = 1, 76 G_OPTION_ERROR_FAILED = 2 77 } 78 79 struct _GOptionEntry 80 { 81 const(gchar)* long_name; 82 gchar short_name; 83 gint flags; 84 GOptionArg arg; 85 gpointer arg_data; 86 const(gchar)* description; 87 const(gchar)* arg_description; 88 } 89 90 struct _GOptionContext; 91 92 93 struct _GOptionGroup; 94 95 version(Derelict_Link_Static) 96 { 97 extern( C ) nothrow 98 { 99 GQuark g_option_error_quark(); 100 GOptionContext* g_option_context_new(const(gchar)* parameter_string); 101 void g_option_context_set_summary(GOptionContext* context, const(gchar)* summary); 102 const(gchar)* g_option_context_get_summary(GOptionContext* context); 103 void g_option_context_set_description(GOptionContext* context, const(gchar)* description); 104 const(gchar)* g_option_context_get_description(GOptionContext* context); 105 void g_option_context_free(GOptionContext* context); 106 void g_option_context_set_help_enabled(GOptionContext* context, gboolean help_enabled); 107 gboolean g_option_context_get_help_enabled(GOptionContext* context); 108 void g_option_context_set_ignore_unknown_options(GOptionContext* context, gboolean ignore_unknown); 109 gboolean g_option_context_get_ignore_unknown_options(GOptionContext* context); 110 void g_option_context_add_main_entries(GOptionContext* context, const(GOptionEntry)* entries, const(gchar)* translation_domain); 111 gboolean g_option_context_parse(GOptionContext* context, gint* argc, gchar*** argv, GError** error); 112 void g_option_context_set_translate_func(GOptionContext* context, GTranslateFunc func, gpointer data, GDestroyNotify destroy_notify); 113 void g_option_context_set_translation_domain(GOptionContext* context, const(gchar)* domain); 114 void g_option_context_add_group(GOptionContext* context, GOptionGroup* group); 115 void g_option_context_set_main_group(GOptionContext* context, GOptionGroup* group); 116 GOptionGroup* g_option_context_get_main_group(GOptionContext* context); 117 gchar* g_option_context_get_help(GOptionContext* context, gboolean main_help, GOptionGroup* group); 118 GOptionGroup* g_option_group_new(const(gchar)* name, const(gchar)* description, const(gchar)* help_description, gpointer user_data, GDestroyNotify destroy); 119 void g_option_group_set_parse_hooks(GOptionGroup* group, GOptionParseFunc pre_parse_func, GOptionParseFunc post_parse_func); 120 void g_option_group_set_error_hook(GOptionGroup* group, GOptionErrorFunc error_func); 121 void g_option_group_free(GOptionGroup* group); 122 void g_option_group_add_entries(GOptionGroup* group, const(GOptionEntry)* entries); 123 void g_option_group_set_translate_func(GOptionGroup* group, GTranslateFunc func, gpointer data, GDestroyNotify destroy_notify); 124 void g_option_group_set_translation_domain(GOptionGroup* group, const(gchar)* domain); 125 } 126 } 127 else 128 { 129 extern( C ) nothrow 130 { 131 alias da_g_option_error_quark = GQuark function(); 132 alias da_g_option_context_new = GOptionContext* function(const(gchar)* parameter_string); 133 alias da_g_option_context_set_summary = void function(GOptionContext* context, const(gchar)* summary); 134 alias da_g_option_context_get_summary = const(gchar)* function(GOptionContext* context); 135 alias da_g_option_context_set_description = void function(GOptionContext* context, const(gchar)* description); 136 alias da_g_option_context_get_description = const(gchar)* function(GOptionContext* context); 137 alias da_g_option_context_free = void function(GOptionContext* context); 138 alias da_g_option_context_set_help_enabled = void function(GOptionContext* context, gboolean help_enabled); 139 alias da_g_option_context_get_help_enabled = gboolean function(GOptionContext* context); 140 alias da_g_option_context_set_ignore_unknown_options = void function(GOptionContext* context, gboolean ignore_unknown); 141 alias da_g_option_context_get_ignore_unknown_options = gboolean function(GOptionContext* context); 142 alias da_g_option_context_add_main_entries = void function(GOptionContext* context, const(GOptionEntry)* entries, const(gchar)* translation_domain); 143 alias da_g_option_context_parse = gboolean function(GOptionContext* context, gint* argc, gchar*** argv, GError** error); 144 alias da_g_option_context_set_translate_func = void function(GOptionContext* context, GTranslateFunc func, gpointer data, GDestroyNotify destroy_notify); 145 alias da_g_option_context_set_translation_domain = void function(GOptionContext* context, const(gchar)* domain); 146 alias da_g_option_context_add_group = void function(GOptionContext* context, GOptionGroup* group); 147 alias da_g_option_context_set_main_group = void function(GOptionContext* context, GOptionGroup* group); 148 alias da_g_option_context_get_main_group = GOptionGroup* function(GOptionContext* context); 149 alias da_g_option_context_get_help = gchar* function(GOptionContext* context, gboolean main_help, GOptionGroup* group); 150 alias da_g_option_group_new = GOptionGroup* function(const(gchar)* name, const(gchar)* description, const(gchar)* help_description, gpointer user_data, GDestroyNotify destroy); 151 alias da_g_option_group_set_parse_hooks = void function(GOptionGroup* group, GOptionParseFunc pre_parse_func, GOptionParseFunc post_parse_func); 152 alias da_g_option_group_set_error_hook = void function(GOptionGroup* group, GOptionErrorFunc error_func); 153 alias da_g_option_group_free = void function(GOptionGroup* group); 154 alias da_g_option_group_add_entries = void function(GOptionGroup* group, const(GOptionEntry)* entries); 155 alias da_g_option_group_set_translate_func = void function(GOptionGroup* group, GTranslateFunc func, gpointer data, GDestroyNotify destroy_notify); 156 alias da_g_option_group_set_translation_domain = void function(GOptionGroup* group, const(gchar)* domain); 157 } 158 159 __gshared 160 { 161 da_g_option_error_quark g_option_error_quark; 162 da_g_option_context_new g_option_context_new; 163 da_g_option_context_set_summary g_option_context_set_summary; 164 da_g_option_context_get_summary g_option_context_get_summary; 165 da_g_option_context_set_description g_option_context_set_description; 166 da_g_option_context_get_description g_option_context_get_description; 167 da_g_option_context_free g_option_context_free; 168 da_g_option_context_set_help_enabled g_option_context_set_help_enabled; 169 da_g_option_context_get_help_enabled g_option_context_get_help_enabled; 170 da_g_option_context_set_ignore_unknown_options g_option_context_set_ignore_unknown_options; 171 da_g_option_context_get_ignore_unknown_options g_option_context_get_ignore_unknown_options; 172 da_g_option_context_add_main_entries g_option_context_add_main_entries; 173 da_g_option_context_parse g_option_context_parse; 174 da_g_option_context_set_translate_func g_option_context_set_translate_func; 175 da_g_option_context_set_translation_domain g_option_context_set_translation_domain; 176 da_g_option_context_add_group g_option_context_add_group; 177 da_g_option_context_set_main_group g_option_context_set_main_group; 178 da_g_option_context_get_main_group g_option_context_get_main_group; 179 da_g_option_context_get_help g_option_context_get_help; 180 da_g_option_group_new g_option_group_new; 181 da_g_option_group_set_parse_hooks g_option_group_set_parse_hooks; 182 da_g_option_group_set_error_hook g_option_group_set_error_hook; 183 da_g_option_group_free g_option_group_free; 184 da_g_option_group_add_entries g_option_group_add_entries; 185 da_g_option_group_set_translate_func g_option_group_set_translate_func; 186 da_g_option_group_set_translation_domain g_option_group_set_translation_domain; 187 } 188 }